package com.example.my2048;

import android.content.Context;
import android.hardware.SensorManager;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

import com.example.my2048.game.manager.GameSensorManager;
import com.example.my2048.game.model.Board;
import com.example.my2048.game.view.BoardView;

public class GameActivity extends AppCompatActivity {
    private GameSensorManager gameSensorManager;
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game);
        Board board = new Board(10, 10);
        BoardView boardView = findViewById(R.id.boardView);
        boardView.setBoard(board);
        gameSensorManager = new GameSensorManager((SensorManager) getSystemService(Context.SENSOR_SERVICE), board, boardView);
        gameSensorManager.registerListener();
    }
    @Override
    protected void onPause(){
        super.onPause();
        gameSensorManager.unregisterListener();
    }
}
